package org.imraniqbal.frogger;

import org.imraniqbal.engine.Item;
import org.imraniqbal.engine.Map;
import org.imraniqbal.engine.Mappable;

public class Home extends Item {

	public Home(int x, int y) {
		super(x, y);
	}

	@Override
	public void action(Object obj, Map map) {
		if(!(obj instanceof FroggerGame)){ return; }
		Frogger tempFrogger = ((FroggerGame)obj).getFrogger();
		if( tempFrogger.isHasFlower()){
			((FroggerGame)obj).setWin(true);
		}
	}
	/**
	 * @author imran
	 */
	@Override
	public boolean equals(Object obj){
		if(obj instanceof Home){
			return(((Mappable)obj).getX() == this.getX() && this.getY() == ((Mappable)obj).getY());
		}
		return false;
	}
}
